package com.mi.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.mi.entity.User;
import com.mi.service.UserService;
import com.mi.util.NoteResult;
import com.opensymphony.xwork2.ActionSupport;

@Controller
public class UserAction extends ActionSupport{
    
	@Resource
	private UserService service;
	
	private String userName;
	
	private String userPassword;
	
    private String userPhone;
	
	private NoteResult result;
	
	/*登录验证*/
	public String LoginUser(){
		result=service.LoginUser(userName, userPassword);
		return SUCCESS;
	}
	
	/*注册添加用户*/
	public String addUser(){
		User user =new User();
        user.setUserName(userName);
        user.setUserPassword(userPassword);
        user.setUserPhone(userPhone);		
		result= service.addUser(user);
	
		return SUCCESS;
	}
	
	/*校验用户名是否存在*/
	public String UserGet(){
		result= service.UserGet(userName);
		
		return SUCCESS;
	}

	
	
	
	public NoteResult getResult() {return result;}
	public void setResult(NoteResult result) {	this.result = result;}
	public String getUserName() {return userName;}
	public void setUserName(String userName) {this.userName = userName;}
	public String getUserPassword() {return userPassword;}
	public void setUserPassword(String userPassword) {this.userPassword = userPassword;}
	public String getUserPhone() {return userPhone;}
    public void setUserPhone(String userPhone) {this.userPhone = userPhone;}
	
	
}
